<template>
	<view>
		<nav-back></nav-back>

		<view class="title">
			<text>您的体重是多少 </text>
		</view>
		<view class="tip">最真实的自己，更快遇到最应该的那个人</view>


		<picker-view @change="changeWeight" :value="weightValue" class="my-picker-view">
			<picker-view-column>
				<view class="item" v-for="(item,index) in weightList" :key="index">{{item}} kg</view>
			</picker-view-column>
		</picker-view>

		<button class="next" type="primary" @click="handleNext">下一步</button>
	</view>
</template>

<script>
	import request from '@/utils/request.js'
	import NavBack from '@/components/NavBack.vue'

	export default {
		components: {
			NavBack
		},
		data() {
			return {
				weightList: [],
				weight: '',
				weightValue: [40],
			}
		},
		onLoad() {
			this.inniList()
		},
		methods: {
			inniList() {
				for (let i = 110; i > 30; i--) {
					this.weightList.push(i)
				}
				this.weight = this.weightList[40]
			},
			changeWeight(event) {
				let current = event.detail.value[0]
				console.log(current, 'changeWeight');
				this.weightValue[0] = current
				this.weight = this.weightList[current]
			},
			handleNext() {
				getApp().globalData.userInfo.weight = this.weight
				console.log(this.weight, 'this.weight');
				uni.redirectTo({
					url: '/pages/userInfo/careerInfo/careerInfo'
				})
			},
		}
	}
</script>

<style lang="scss">
	@import "@/style/register.scss";
</style>